#include "pthread.h"
#include "stdio.h"
#include  <unistd.h>


void *pthreadCallback(void *parm)
{
    int p = (int*)parm;

    /* 线程1 */
    if (p == 1)
    {
        printf("线程1运行\n");
    }
    /* 线程2 */
    else if (p == 2)
    {
        printf("线程2运行\n");
    }
}

int main(int argc, char const *argv[])
{
    pthread_t p1 = 0;
    pthread_t p2 = 0;

    printf("主线成运行\n");

    pthread_create(&p1, NULL, pthreadCallback, 1);
    pthread_create(&p2, NULL, pthreadCallback, 2);

    pthread_join(p1,NULL);
    pthread_join(p2,NULL);


    printf("主线成运行结束\n");

    return 0;
}
